﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Util.Ui.Trees;

namespace IterationLife.PlatformBackEnd.AppServices.Dtos.ContentResources {
    /// <summary>
    /// 内容资源评论数据传输对象
    /// </summary>
    [DataContract]
    public class ContentResourceCommentDto : TreeDtoBase {
        /// <summary>
        /// 内容资源编号
        /// </summary>
        [Display( Name = "内容资源编号" )]
        [DataMember]
        public Guid? ContentResourceId { get; set; }

        /// <summary>
        /// 内容资源编号
        /// </summary>
        [Display(Name = "内容资源标题")]
        [DataMember]
        public string ContentResourceTitle { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        [Required(ErrorMessage = "内容不能为空")]
        [StringLength( 800, ErrorMessage = "内容输入过长，不能超过800位" )]
        [Display( Name = "内容" )]
        [DataMember]
        public string Content { get; set; }
        
        /// <summary>
        /// 用户编号
        /// </summary>
        [Required(ErrorMessage = "用户编号不能为空")]
        [Display( Name = "用户编号" )]
        [DataMember]
        public Guid UserId { get; set; }
        
        /// <summary>
        /// 用户名
        /// </summary>
        [Required(ErrorMessage = "用户名不能为空")]
        [StringLength( 30, ErrorMessage = "用户名输入过长，不能超过30位" )]
        [Display( Name = "用户名" )]
        [DataMember]
        public string UserName { get; set; }
        
        /// <summary>
        /// 创建时间
        /// </summary>
        [Display( Name = "创建时间" )]
        [DataMember]
        public DateTime? CreationTime { get; set; }
        
        /// <summary>
        /// 最后修改时间
        /// </summary>
        [Display( Name = "最后修改时间" )]
        [DataMember]
        public DateTime? LastModificationTime { get; set; }
        
        /// <summary>
        /// 最后修改人
        /// </summary>
        [Display( Name = "最后修改人" )]
        [DataMember]
        public Guid? LastModifierId { get; set; }
        
        /// <summary>
        /// 是否删除
        /// </summary>
        [Required(ErrorMessage = "是否删除不能为空")]
        [Display( Name = "是否删除" )]
        [DataMember]
        public bool IsDeleted { get; set; }
        
        /// <summary>
        /// 版本号
        /// </summary>
        [Display( Name = "版本号" )]
        [DataMember]
        public Byte[] Version { get; set; }
        
        /// <summary>
        /// 输出内容资源评论状态
        /// </summary>
        public override string ToString() {
            return this.ToEntity().ToString();
        }
    }
}
